/*    */ package com.qmsk.business.info.advertisement.controller;
/*    */ 
/*    */ import com.qmsk.business.htmlUtils.controller.HtmlUtilsController;
/*    */ import com.qmsk.business.info.advertisement.dao.AdvertisementDAO;
/*    */ import com.utils.basic.MapUtils;
/*    */ import com.utils.gson.in.GsonHeadOneRow;
/*    */ import com.utils.gson.out.GsonEbRst;
/*    */ import com.utils.web.RequestUtils;
/*    */ import com.utils.web.ResponseUtils;
/*    */ import java.util.Date;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.web.bind.annotation.PathVariable;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"/ad"})
/*    */ public class AdvertisementController
/*    */ {
/* 29 */   private static final Logger logger = Logger.getLogger(AdvertisementController.class);
/*    */ 
/*    */   @Autowired
/*    */   private AdvertisementDAO dao;
/*    */ 
/*    */   @RequestMapping(value={"find/adList"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public void getListOptShopId(HttpServletRequest request, HttpServletResponse response) {
/*    */     try {
/* 37 */       Map params = new HashMap();
/* 38 */       MapUtils.addToMap(params, "status", 
/* 39 */         Integer.valueOf(0));
/* 40 */       String shopId = RequestUtils.getString(request, "shopId");
/* 41 */       MapUtils.addToMap(params, "shopId", shopId);
/* 42 */       MapUtils.addToMap(params, "locationId", 
/* 43 */         RequestUtils.getString(request, "locationId"));
/* 44 */       MapUtils.addToMap(params, "dtBegin", 
/* 45 */         new Date());
/* 46 */       GsonEbRst gsonEbRst = this.dao.getGsonOfAll(params);
/* 47 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*    */     } catch (Exception e) {
/* 49 */       logger.error(e);
/* 50 */       ResponseUtils.setErrorMsgResponse(
/* 51 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */   }
/*    */ 
/*    */   @RequestMapping(value={"update/num/{id}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public void update(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") Long id)
/*    */   {
/*    */     try
/*    */     {
/* 60 */       Map params = new HashMap();
/* 61 */       MapUtils.addToMap(params, "id", id);
/* 62 */       GsonHeadOneRow gsonEbRst = this.dao.getOneRow(params);
/*    */ 
/* 64 */       int nResult = 0;
/* 65 */       nResult = this.dao.updateNumber(id);
/* 66 */       if (nResult > 0) {
/* 67 */         this.dao.commit();
/* 68 */         String indexUrl = (String)gsonEbRst.getValueOfName("indexUrl");
/* 69 */         String html = HtmlUtilsController.readInputStream(indexUrl);
/* 70 */         String title = (String)gsonEbRst.getValueOfName("title");
/* 71 */         String[] head = { "html", "title" };
/* 72 */         Object[] data = { html, title };
/* 73 */         ResponseUtils.toGsonEbRst(head, data, response);
/* 74 */         return; }
/* 75 */       this.dao.rollback();
/* 76 */       ResponseUtils.setErrorMsgResponse(
/* 77 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */     catch (Exception e)
/*    */     {
/* 81 */       this.dao.rollback();
/* 82 */       logger.error(e);
/* 83 */       ResponseUtils.setErrorMsgResponse(
/* 84 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.info.advertisement.controller.AdvertisementController
 * JD-Core Version:    0.5.3
 */